<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@include file="/page/common/public.jspf"%>
<%@ page import="com.hengpeng.itfints.tools.PageUtil"%>
<%
	PageUtil pageUtil = (PageUtil) request.getAttribute("PageUtil");
%>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="${path }/css/index.css" />
<link rel="stylesheet" type="text/css"
	href="${path }/css/mh/paginate.v1.css">
<script type="text/javascript"
	src="${path }/js/common/jquery1.10.2.min.js"></script>

<title>魔环理财-投资列表</title>
<script type="text/javascript">

function selectTag(showType){
	if (showType == "INVEST") {//投标产品列表
		window.location.href = "<%=request.getContextPath()%>/borrowInfo/list.htm";
	} else if (showType == "ASSIGN") {//债权产品列表
		window.location.href = "<%=request.getContextPath()%>/assign/list.htm";
	} else {
		
	}
}
//分页
function go(page, total) {
	if (page > total) {
		page = total;
	}
	$("#curPage").val(page);
	$("#myform").submit();
}
$(document).ready(function(){
	//$("#zt").val($("#h_zt").val());
	//$("#qx").val($("#h_qx").val());
	//$("#sy").val($("#h_sy").val());
	//$("#gm").val($("#h_gm").val());
	//$("#area").val($("#h_area").val());
	//$("#guran").val($("#h_guran").val());
	
	$("a[isSearch='YES']").click(function(){
		var k = $(this).attr("searchName");
		var v = $(this).attr("searchValue");
		$("#"+k).val(v);
		$("#myform").submit();
	});
	
	$("a[isSearch='YES']").removeClass("cur");
	$("input[type='hidden']").each(function(){
		var name = $(this).attr("name");
		var v = $(this).val();
		$("a[isSearch='YES'][searchName='"+name+"'][searchValue='"+v+"']").addClass("cur");
	});
});
</script>
</head>

<body>
	<c:import url="../include/top.jsp">
		<c:param name="type" value="wytz"></c:param>
	</c:import>
	<!--面包屑导航开始-->
	<section class="crumbs">
		<div class="w1100">
			<a href="${path}">首页</a> <i></i><span>投资列表</span>
		</div>
	</section>
	<!--面包屑导航结束-->

	<form id="myform"
		action="<%=request.getContextPath()%>/borrowInfo/list.htm">
		<input type="hidden" id="curPage" name="curPage" /> <input
			type="hidden" id="zt" name="zt" value="${zt }" /> <input
			type="hidden" id="qx" name="qx" value="${qx }" /> <input
			type="hidden" id="sy" name="sy" value="${sy }" /> <input
			type="hidden" id="gm" name="gm" value="${gm }" /> <input
			type="hidden" id="area" name="area" value="${area }" /> <input
			type="hidden" id="guran" name="guran" value="${guran }" />
		<div class="p_deal">
			<section class="main">
				<div class="ui_product_tab box mb30">
					<div class="product_type">
						<div class="fl title">
							<i class="icon_line mr15"></i>P2P理财
						</div>
						<div class="fg_line"></div>
					</div>
					<div class="tabbd">

						<div class="con">
							<div class="conbd">
								<c:forEach items="${dataList}" var="auto" varStatus="sta">
									<div class="p2p_product p5">
										<div class="clearfix bg_whtie">
											<div class="con_l">
												<h3 class="f16">
													<!--icon-->
													<i class="icon_CRD"></i>
													<!--/icon-->
													<c:choose>
													<c:when test="${auto.status eq 'RAISE'}">
														<a title="${auto.borrowName}" alt="${auto.borrowName}"
														href="<?=$siteurl?>deals/more.php" target="_blank">${auto.borrowName}</a>
													</c:when>
													<c:otherwise>
														<span title="${auto.borrowName}" alt="${auto.borrowName}" class="deal_tag_name">${auto.borrowName}</span>
													</c:otherwise>
												</c:choose>
													
													<!-- <i class="deal_tips bg_blue" title="">国庆特惠标</i> -->
												</h3>
												<div class="fl w360">
													<p>
														<span>年化收益率： <i class="f20"> ${auto.borrowRate}
														</i> <ins class="f20">%</ins>
														</span>
													</p>
													<p>
														<span>总额：</span> ${auto.borrowMoney/100/10000}万
													</p>
												</div>
												<div class="fl w265">
													<p>
														<span>投资期限：</span> <em><i class="f18">${auto.borrowDuration}</i>个月</em>
													</p>
													<p>
														<span>收益方式：</span> ${auto.repaymentType.text }
													</p>
												</div>
												<div class="fl w265 progress_rate"
													total="${auto.borrowMoney}" has="${auto.raiseMoney}">
													<p>
														<span>投资进度：</span><span class="progress"> <i
															class="ico_bace"></i> <i class="ico_yitou">进度条</i>
														</span>
														<ins class="f12 pl5"></ins>
													</p>
													<p>
														<span>剩余可投：</span>${(auto.borrowMoney-auto.raiseMoney)/100}元
													</p>
												</div>
											</div>
											<div class="product_btn">
												<c:choose>
													<c:when test="${auto.status eq 'RAISE'}">
														<a href="${path }/borrowInfo/detail.htm?borrowInfoId=1444131202065000" class="btn_touzi">投资</a>
													</c:when>
													<c:when
														test="${auto.status eq 'RAISE' && (auto.raiseMoney / auto.borrowMoney) == 1}">
														<span class="btn_manbiao">满标</span>
													</c:when>
													<c:when
														test="${auto.status ne 'RAISE' && (auto.raiseMoney / auto.borrowMoney) == 1}">
														<span class="btn_manbiao">已结束</span>
													</c:when>
													<c:otherwise>
														<span class="btn_manbiao">已结束</span>
													</c:otherwise>
												</c:choose>

											</div>
										</div>
									</div>
								</c:forEach>
							</div>
							<div id="pagination" class="pagination">
								<ul>
									<c:choose>
										<c:when test="${PageUtil.currentPage==1 }">
											<li><span name="pagebar_frist" class="current prev" title="首页">首页</span></li>
											<li><span name="pagebar_pre" class="current prev" title="上一页">上一页</span></li>
										</c:when>
										<c:otherwise>
											<li><a
												onclick="javascript:go(1,<%=pageUtil.getPageCount()%>);"
												href="javascript:void(0);" name="pagebar_frist"
												class="current prev" title="首页">首页</a></li>
											<li><a
												onclick="javascript:go(<%=(pageUtil.getCurrentPage() - 1)%>,<%=pageUtil.getPageCount()%>);"
												name="pagebar_pre" href="javascript:void(0);"
												class="current prev" title="上一页">上一页</a></li>
										</c:otherwise>
									</c:choose>
									<%
										if (pageUtil.getPageCount() <= 10) {
									%>
									<c:forEach var="index" begin="1"
										end="<%=pageUtil.getPageCount()%>">
										<c:choose>
											<c:when test="${PageUtil.currentPage ==index }">
												<li class="active"><span class="current">${index }</span></li>
											</c:when>
											<c:otherwise>
												<li><a
													onclick="javascript:go(${index },<%=pageUtil.getPageCount()%>);"
													href="javascript:void(0);" class="page-link">${index }</a></li>
											</c:otherwise>
										</c:choose>

									</c:forEach>
									<%
										} else if (pageUtil.getPageCount() > 10
												&& pageUtil.getCurrentPage() < 10) {
									%>
									<c:forEach var="index" begin="1" end="9">
										<c:choose>
											<c:when test="${PageUtil.currentPage ==index }">
												<li class="active"><span class="current">${index }</span></li>
											</c:when>
											<c:otherwise>
												<li><a
													onclick="javascript:go(${index },<%=pageUtil.getPageCount()%>);"
													href="javascript:void(0);" class="page-link">${index }</a></li>
											</c:otherwise>
										</c:choose>
										<li class="disabled"><span class="ellipse">&hellip;</span></li>
										<li><a
											href="javascript:go(<%=pageUtil.getPageCount()%>,<%=pageUtil.getPageCount()%>);"
											class="page-link"><%=pageUtil.getPageCount()%></a></li>
									</c:forEach>
									<%
										} else if (pageUtil.getPageCount() > 10
												&& pageUtil.getCurrentPage() >= 10
												&& (pageUtil.getPageCount() - pageUtil.getCurrentPage()) < 9) {
									%>
									<c:forEach var="index"
										begin="<%=pageUtil.getCurrentPage() - 1%>"
										end="<%=pageUtil.getCurrentPage() + 8%>">
										<c:choose>
											<c:when test="${PageUtil.currentPage ==index }">
												<li class="active"><span class="current">${index }</span></li>
											</c:when>
											<c:otherwise>
												<li><a
													onclick="javascript:go(${index },<%=pageUtil.getPageCount()%>);"
													href="javascript:void(0);" class="page-link">${index }</a></li>
											</c:otherwise>
										</c:choose>
									</c:forEach>
									<%
										} else if (pageUtil.getPageCount() > 10
												&& pageUtil.getCurrentPage() >= 10
												&& (pageUtil.getPageCount() - pageUtil.getCurrentPage()) >= 9) {
									%>
									<c:forEach var="index" begin="<%=pageUtil.getCurrentPage() - 1%>"
										end="<%=pageUtil.getCurrentPage() + 7%>">
										<c:choose>
											<c:when test="${PageUtil.currentPage ==index }">
												<li class="active"><span class="current">${index }</span></li>
											</c:when>
											<c:otherwise>
												<li><a
													onclick="javascript:go(${index },<%=pageUtil.getPageCount()%>);"
													href="javascript:void(0);" class="page-link">${index }</a></li>
											</c:otherwise>
										</c:choose>
										<li class="disabled"><span class="ellipse">&hellip;</span></li>
										<li><a
											href="javascript:go(<%=pageUtil.getPageCount()%>,<%=pageUtil.getPageCount()%>);"
											class="page-link"><%=pageUtil.getPageCount()%></a></li>
									</c:forEach>
									<%
										}
									%>
									<%if(pageUtil.getCurrentPage()==pageUtil.getPageCount()) {%>
									<li><span name="pagebar_frist" class="current prev" title="下一页">下一页</span></li>
											<li><span name="pagebar_pre" class="current prev" title="尾页">尾页</span></li>
									<%}else{ %>
									<li><a
										onclick="javascript:go(<%=(pageUtil.getCurrentPage() + 1)%>,<%=pageUtil.getPageCount()%>);"
										href="javascript:void(0);" name="pagebar_next"
										class="page-link next" title="下一页">下一页</a></li>
									<li><a
										onclick="javascript:go(<%=pageUtil.getPageCount()%>,<%=pageUtil.getPageCount()%>);"
										href="javascript:void(0);" name="pagebar_last"
										class="page-link next" title="尾页">尾页</a></li>
										<%} %>
								</ul>
							</div>
						</div>
					</div>
				</div>
			</section>
		</div>
	</form>
	<script type="text/javascript">
		;
		(function() {
			//项目进度
			progress_rate($('.progress_rate'));
			function progress_rate(ele) {
				ele.each(function(i, el) {
					var ele = $(el);
					var total = ele.attr('total');
					var has = ele.attr('has');
					var REG = /^[\d\.]+$/;
					var percent = 0;
					if (!(REG.test(total) && REG.test(has))) {
						return;
					}
					total = Math.floor(total.replace(/\..*/, ''));
					has = Math.floor(has.replace(/\..*/, ''));
					percent = (Math.floor((has / total) * 10000) / 100)
							.toFixed(2)
							+ "%";
					ele.find('.ico_yitou').css("width", percent);
					ele.find('.pl5').html(percent);
					// console.log(i, total, has, percent);
				});
			}
		})('p2p理财页面');
	</script>


	<?php include "../foot.php";?>
</body>
</html>